package com.github.yoojia.flow.zmq;

import org.zeromq.ZMQ;

/**
 * @author 陈哈哈 yoojiachen@gmail.com
 */
public class ZMQSimulatePongDriver {

    public static void main(String[] args) throws Exception {
        final ZMQ.Context context = ZMQ.context(1);

        final ZMQ.Socket responder = context.socket(ZMQ.REP);
        responder.bind("tcp://*:5001");

        while (!Thread.currentThread().isInterrupted()) {
            final String text = responder.recvStr();
            System.out.println("接收到远程Payload: " + text);
            responder.send("ZMQ.PONG");
        }
        responder.close();
        context.term();
    }
}
